console.log('------------------------------------');
const m = new Map();
console.log(m);//Map {}
const m1 = new Map([['name','silly'],['age',45],['sex','female']]);
console.log(m1);//Map { 'name' => 'silly', 'age' => 45, 'sex' => 'female' }
console.log(m1.size);//3
const m2 = new Map({
    [Symbol.iterator]:function *(){
        yield ['id','001'];
        yield ['score',78];
        yield ['grade','高中']
    }
});
console.log(m2);//Map { 'id' => '001', 'score' => 78, 'grade' => '高中' }
console.log(m2.size);//3
console.log('---------------------------------------');
const m3 = new Map([[]]);
console.log(m3.has('firstName'));//false
console.log(m3.get('firstName'));//undefined
console.log(m3.size);//1
console.log('---------------------------------------');
const m4 = new Map();
m4.set('firstName','Matt')
  .set('lastName','Frisbie');
console.log(m4.has('firstName'));//true
console.log(m4.get('firstName'));//Matt
console.log(m4.size);//2
m4.delete('firstName');
console.log(m4.has('firstName'));//false
console.log(m4.get('firstName'));//undefined
console.log(m4.has('lastName'));//true
console.log(m4.get('lastName'));//Frisbie
console.log(m4.size);//1
m4.clear();
console.log(m4.has('lastName'));//false
console.log(m4.get('lastName'));//undefined
console.log('------------------------------------------------');
const m5 = new Map();
const functionKey = function(){};
const symbolKey = Symbol();
const objectKey = new Object();
m5.set(functionKey,"functionKeyValue");
m5.set(symbolKey,"symbolKeyValue");
m5.set(objectKey,"objectKeyValue");
console.log(m5.get(functionKey));//functionKeyValue
console.log(m5.get(symbolKey));//symbolKeyValue
console.log(m5.get(objectKey));//objectKeyValue
console.log(m5.get(function(){}));//undefined
console.log('------------------------------------------------');
const m6 = new Map();
const objKey = {},
      objValue = {},
      arrKey = [],
      arrValue = [];
m6.set(objKey,objValue);
m6.set(arrKey,arrValue);
console.log(m6.get(objKey));//{}
console.log(m6.get(arrKey));//[]
objKey.foo = 'foo';
objValue.bar = 'bar';
arrKey.push('foo');
arrValue.push('bar');
console.log(m6.get(objKey));//{ bar: 'bar' }
console.log(m6.get(arrKey));//[ 'bar' ]

console.log('-------------------------------------------------------');
const m7 = new Map();
const a = 0 /"",//NaN
      b = 0 /"",//NaN
      pz = +0;
      nz = -0;
console.log(a === b);//false
console.log(pz === nz);//true
m7.set(a,'foo');
m7.set(b,'bar');
m7.set(pz,'pzname');
m7.set(nz,'nzname');
console.log(m7.get(a));//bar
console.log(m7.get(b));//bar
console.log(m7.get(pz));//nzname
console.log(m7.get(nz));//nzname
